import Login from '@/views/login'
import Test from '@/views/test'
import Layout from '@/views/layout'
import Home from '@/views/home'
import Debugger from '@/views/debugger'

const isDev = process.env.NODE_ENV === 'development'

const constantRoutes = [
  {
    path: '/login',
    component: Login,
    hidden: true
  },
  {
    path: '',
    name: 'root',
    component: Layout,
    redirect: { name: 'home' },
    defaultHidden: true,
    meta: { title: '根目录', icon: 'el-icon-menu' },
    children: [
      {
        path: '',
        name: 'home',
        component: Home,
        meta: { title: '幻熊后台', icon: 'el-icon-menu' }
      }
    ]
  },
  {
    path: '/debugger',
    name: 'debuggerRoot',
    component: Layout,
    defaultHidden: true,
    hidden: true,
    redirect: { name: 'debugger' },
    meta: { title: 'debugger页面', icon: 'bug' },
    children: [
      {
        path: '',
        name: 'debugger',
        component: Debugger,
        meta: { title: 'debugger', icon: 'bug' }
      }
    ]
  },
  {
    path: '*',
    redirect: { name: 'home' }
  }
]
// 开发环境引入test页面
if (isDev) {
  constantRoutes.push({
    path: '/test',
    name: 'testRoot',
    component: Layout,
    defaultHidden: true,
    // hidden: true,
    redirect: { name: 'test' },
    meta: { title: 'test', icon: 'el-icon-tickets' },
    children: [
      {
        path: '',
        name: 'test',
        component: Test,
        meta: { title: 'test', icon: 'el-icon-tickets' }
      }
    ]
  })
}

export default constantRoutes
